package com.junki.officecontentsearch.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * @author junki
 * @date 2021/5/28 15:14
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Document(indexName = "index-file")
public class IndexFile {

    @Id
    @Field
    private String id;

    // 原文件名
    @Field(type = FieldType.Keyword)
    private String filename;

    // 保存文件名
    @Field(type = FieldType.Keyword)
    private String saveName;

    // 文件类型
    @Field(type = FieldType.Keyword)
    private String type;

    // 文件内容
    @Field(type = FieldType.Text, analyzer = "ik_smart")
    private String content;

    // 分词查询高亮结果
    @Transient
    private String contentResult;

    // 匹配分数
    @Transient
    private Float score;

}
